import type { RouteRecordStringComponent } from '@vben/types';

import { baseRequestClient, requestClient } from '#/api/request';
// 树形数据
export async function getAllTree(
  content: null | number | string,
  companyNodeId: null | number | string,
) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getCompanyTree?content=${content}&companyNode=${companyNodeId}`,
  );
}
// 子公司获取热源站
export async function getCompanyHeatStation(
  childCompanyId: null | number | string,
) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHeatSourceByChildCompanyID?childCompanyId=${childCompanyId}`,
  );
}
// 热源获取换热站
export async function getHeatStationHeatStation(
  heatSourceID: null | number | string,
) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHeatStationByHeatSourceID?heatSourceID=${heatSourceID}`,
  );
}
//  子公司获取小区
export async function getCompanyCommunity(
  childCompanyId: null | number | string,
) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getVillageByChildCompanyID?childCompanyId=${childCompanyId}`,
  );
}
//  小区获取楼栋
export async function getVillageBuilding(villageID: null | number | string) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getBuildingByVillageID?villageID=${villageID}`,
  );
}
//  楼栋获取单元
export async function getBuildingUnit(buildingID: null | number | string) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getUnitByBuildingID?buildingID=${buildingID}`,
  );
}
//  单元获取户
export async function getUnitHouse(unitID: null | number | string) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHouseByUnitID?unitID=${unitID}`,
  );
}
// 热源表格默认加载
export async function getHeatSourceTable(
  page: number,
  limit: number,
  heatSourceID?: null | number | string | string[],
  searchName?: string,
) {
  return baseRequestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHeatSource?page=${page}&limit=${limit}&companyNode=${heatSourceID}&searchName=${searchName}`,
  );
}
// 换热站表格默认搜索
export async function getHeatStationTableSearch(
  page: number,
  limit: number,
  heatStationID?: null | number | string | string[],
  searchName?: string,
) {
  return baseRequestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getheatExchangeStation?page=${page}&limit=${limit}&companyNode=${heatStationID}&searchName=${searchName}`,
  );
}
// 小区表格默认搜索
export async function getVillageTableSearch(
  page: number,
  limit: number,
  villageID?: null | number | string | string[],
  searchName?: string,
) {
  return baseRequestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getVillageInfo?page=${page}&limit=${limit}&companyNode=${villageID}&searchName=${searchName}`,
  );
}
//  楼栋表格默认搜索
export async function getBuildingTableSearch(
  page: number,
  limit: number,
  house?: null | number | string | string[],
  searchName?: string,
) {
  return baseRequestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHouseInfo?page=${page}&limit=${limit}&companyNode=${house}&searchName=${searchName}`,
  );
}
// 保存文件(热源)
export async function importFile() {
  return baseRequestClient.post(`/ChargeSystem/import/saveHeatSourceData`);
}
// 保存文件(换热站)
export async function importFileHeatStation() {
  return baseRequestClient.post(
    `/ChargeSystem/import/saveHeatExchangeStationData`,
  );
}
// 保存文件(小区)
export async function importFileVillage() {
  return baseRequestClient.post(`/ChargeSystem/import/saveVillageData`);
}
// 保存文件(户)
export async function importFileHouse() {
  return baseRequestClient.post(`/ChargeSystem/import/addSave`);
}
// 验证热用户上传数据
export async function importFileHeatExchangeStationDetail() {
  return baseRequestClient.post(`/ChargeSystem/import/findProblemInformation`);
}
// 热用户详情
export async function getHeatUserInfo(houseId: null | number | string) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getHouseDetailInfo?houseId=${houseId}`,
  );
}
// 删除临时表
export async function deleteTempTable() {
  return requestClient.post(`/ChargeSystem/import/deleteTemporaryTable`);
}
// 热源修改
export async function updateHeatSource(data: any) {
  return requestClient.post(`/ChargeSystem/khzywh/updateHeatSource`, data);
}
// 换热站修改
export async function updateHeatStation(data: any) {
  return requestClient.post(
    `/ChargeSystem/khzywh/updateHeatExchangeStation`,
    data,
  );
}
// 小区修改
export async function updateVillage(data: any) {
  return requestClient.post(`/ChargeSystem/khzywh/updateVillage`, data);
}
// 户修改
export async function updateHouse(data: any) {
  return requestClient.post(`/ChargeSystem/khzywh/updateHouseDetail`, data);
}
// 修改面积

export async function updateHouseArea(data: any) {
  return requestClient.post(`/ChargeSystem/khzywh/updateAreaDetail`, data);
}
// 客户标签导入查询
export async function getCustomerLabelImport(data: any) {
  return baseRequestClient.post<RouteRecordStringComponent[]>(
    `/ChargeSystem/customerLabel/getLabelImportHistoryPage`,
    data,
  );
}
// 客户标签上传
export async function uploadCustomerLabel(data: any) {
  return requestClient.post(
    `/ChargeSystem/customerLabel/verifyCustomerLabel`,
    data,
  );
}
// 客户标签导入历史查询
export async function getCustomerLabelImportHistory(data: any) {
  return requestClient.get<RouteRecordStringComponent[]>(
    `/ChargeSystem/khzywh/getCustomerLabelImportHistory`,
    {
      params: {
        ...data,
      },
    },
  );
}
// 添加客户名单
export async function addCustomerLabel(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/customerListMaintenance/addBlacklist`,
    data,
  );
}
// 客户名单查询
export async function getCustomerLabel(data: any) {
  return baseRequestClient.post<RouteRecordStringComponent[]>(
    `/ChargeSystem/customerListMaintenance/getCustomerListPage`,
    data,
  );
}
// 单个删除客户名单
export async function deleteCustomerLabel(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/customerListMaintenance/deleteCustomerList`,
    data,
  );
}
// 批量删除客户名单
export async function deleteCustomerLabelBatch(data: any) {
  return requestClient.post(
    `/ChargeSystem/customerListMaintenance/batchDeleteCustomerList`,
    data,
  );
}
// 客户名单上传
export async function uploadCustomerName(data: any) {
  return requestClient.post(
    `/ChargeSystem/customerListMaintenance/verifyCustomerList`,
    data,
  );
}
// 客户名单导入
export async function importCustomerLabel(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/customerListMaintenance/importCustomerList`,
    data,
  );
}
// 客户名单导入
export async function importCustomerLabel_two(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/customerListMaintenance/importCustomerLabel`,
    data,
  );
}
// 客户名单导入历史查询
export async function importCustomerHistory(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/getImportHistoryPage`,
    data,
  );
}
// 客户名单导出历史查询
export async function exportCustomerHistory(data: any) {
  return baseRequestClient.post(`/ChargeSystem/khzywh/getExportHistoryPage`, {
    ...data,
  });
}
// 资源迁移记录
export async function importCustomerHistory_two(data: any) {
  return baseRequestClient.get(`/ChargeSystem/resource/getDataMigrationPage`, {
    params: {
      ...data,
    },
  });
}
// 归属机构下拉框
export async function getBelongingInstitution() {
  return baseRequestClient.post(`/ChargeSystem/khzywh/companyTreeList`);
}
// 归属机构查小区
export async function getBelongingInstitutionVillage(companyNode: any) {
  return baseRequestClient.post(
    `/ChargeSystem/resource/getVillageSelect?companyNode=${companyNode}`,
  );
}
//归属机构查换热站
export async function getBelongingInstitutionHeatStation(companyNode: any) {
  return baseRequestClient.post(
    `/ChargeSystem/resource/getHeatExchangeStationSelect?companyNode=${companyNode}`,
  );
}
// 归属机构查楼栋
export async function getBelongingInstitutionBuilding(villageID: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/getBuildingByVillageID?villageID=${villageID}`,
  );
}
// 归属机构查户
export async function getBelongingInstitutionHouse(buildingID: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/getUnitByBuildingID?buildingID=${buildingID}`,
  );
}
// 小区迁移左侧搜索
export async function getBelongingInstitutionVillageName(
  companyNode: any,
  villageNode: any,
) {
  return baseRequestClient.get(
    `/ChargeSystem/resource/getVillageBelongToResourcesNow?companyNode=${companyNode}&villageNode=${villageNode}`,
  );
}
// 小区迁移右侧搜索
export async function getBelongingInstitutionVillageName_two(
  villageIds: any,
  heatExchangeStationNode: any,
) {
  return baseRequestClient.get(
    `/ChargeSystem/resource/getMigrationInformationPage?villageIds=${villageIds}&heatExchangeStationNode=${heatExchangeStationNode}`,
  );
}
// 小区迁移操作
export async function getMigrationInformationPage(
  villageIds: any,
  heatExchangeStationNode: any,
) {
  return baseRequestClient.get(
    `/ChargeSystem/resource/villageMigration?villageIds=${villageIds}&heatExchangeStationNode=${heatExchangeStationNode}`,
  );
}
// 住户迁移左侧
export async function getBelongingInstitutionHouseName(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/resource/getHouseBelongToResourcesNow`,
    data,
  );
}
// 住户迁移右侧
export async function getBelongingInstitutionHouseName_two(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/resource/getHouseMigrationInformationPage?`,
    data,
  );
}
// 住户迁移操作
export async function getHouseMigrationInformationPage(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/resource/getHouseMigration`,
    data,
  );
}
// 客户信息导入确认
export async function getCustomerInformationImportConfirm(data: any) {
  return baseRequestClient.post(`/ChargeSystem/import/saveApproval`, data);
}
// 热源批量操作对象接口
export async function getHeatExchangeStationBatchOperation(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getHeatSourceBatchObject?companyNode=${data}`,
  );
}
// 换热站批量操作对象接口
export async function getHeatExchangeStationBatchOperation_two(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getHeatStationBatchObject?companyNode=${data}`,
  );
}
// 小区批量操作对象接口
export async function getVillageBatchOperation(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getVillageBatchObject?companyNode=${data}`,
  );
}
// 楼栋批量操作对象接口
export async function getBuildingBatchOperation(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getBuildingBatchObject?companyNode=${data}`,
  );
}
// 单元批量操作对象接口
export async function getUnitBatchOperation(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getUnitBatchObject?companyNode=${data}`,
  );
}
// 房间批量操作对象接口
export async function getRoomBatchOperation(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/khzywh/getHouseBatchObject?companyNode=${data}`,
  );
}
// 批量删除热源
export async function getHeatSourceBatchOperation(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteHeatSourceApproval`,
    data,
  );
}
// 批量删除换热站
export async function getHeatExchangeStationBatchOperation_three(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteHeatExchangeStationApproval`,
    data,
  );
}
// 批量删除小区
export async function delVillageBatchOperation(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteVillageApproval`,
    data,
  );
}
// 批量删除楼栋
export async function delBuildingBatchOperation(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteBuildingApproval`,
    data,
  );
}
// 批量删除单元
export async function delUnitBatchOperation(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteUnitApproval`,
    data,
  );
}
// 批量删除房间
export async function delRoomBatchOperation(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteHouseDetailApproval`,
    data,
  );
}
// 热源批量修改
export async function getHeatSourceBatchOperation_four(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/batchUpdateHeatSource`,
    data,
  );
}
// 批量修改换热站
export async function getHeatExchangeStationBatchOperation_four(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/batchUpdateHeatExchangeStation`,
    data,
  );
}
// 批量修改小区
export async function getVillageBatchOperation_four(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/batchUpdateVillage`,
    data,
  );
}
// 单独修改房间
export async function getRoomBatchOperation_fours(data: any) {
  return baseRequestClient.post(`/ChargeSystem/khzywh/updateHouseDetail`, data);
}
// 批量修改房间
export async function getRoomBatchOperation_four(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/batchUpdateHouseDetail`,
    data,
  );
}
// 获取用户标签下拉框
export async function getRoomBatchOperation_five() {
  return baseRequestClient.post(`/ChargeSystem/khzywh/gethouseRemarkList`);
}
// 获取住户信息
export async function getRoomBatchOperation_six(houseId: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/getHouseDetailInfo?houseId=${houseId}`,
  );
}
// 修改阀门状态
export async function getRoomBatchOperation_seven(
  areaDetailId: any,
  valveStatus: any,
) {
  return baseRequestClient.post(`/ChargeSystem/khzywh/updateAreaValveStatus`, {
    areaDetailId: areaDetailId,
    valveStatus: valveStatus,
  });
}
// 删除单独面积
export async function getRoomBatchOperation_eight(operateObject: any) {
  return baseRequestClient.post(
    `/ChargeSystem/khzywh/deleteAreaDetailApproval`,
    {
      operateObject: operateObject,
    },
  );
}
// 房屋合同信息查询
export async function getRoomBatchOperation_nine(data: any) {
  return baseRequestClient.post(`/ChargeSystem/khzywh/getContractInfo`, {
    ...data,
  });
}
// 修改面积
export async function getRoomBatchOperation_ten(data: any) {
  return baseRequestClient.post(`/ChargeSystem/khzywh/updateAreaDetail`, {
    ...data,
  });
}
// 导出客户信息
export async function getRoomBatchOperation_eleven(type: string, data: any) {
  // 根据type判断执行不同的接口
  if (type == '热源') {
    return baseRequestClient.post(
      `/ChargeSystem/khzywh/exportHeatSource?companyNode=${data}`,
    );
  } else if (type == '换热站') {
    return baseRequestClient.post(
      `/ChargeSystem/khzywh/exportHeatExchangeStation?companyNode=${data}`,
    );
  } else if (type == '小区') {
    return baseRequestClient.post(
      `/ChargeSystem/khzywh/exportVillage?companyNode=${data}`,
    );
  } else if (type == '房间') {
    return baseRequestClient.post(
      `/ChargeSystem/khzywh/exportHouse?companyNode=${data}`,
    );
  }
}
